package jkernel;

import java.math.BigDecimal;
import java.math.BigInteger;
import java.math.RoundingMode;

public class BigInt {

    public static void main(String[] args) {
        BigInteger n = new BigInteger("999999").pow(99);
        float f = n.floatValue();
        System.out.println(f);

        BigDecimal d1 = new BigDecimal("123.456789");
        BigDecimal d2 = d1.setScale(4, RoundingMode.HALF_UP); // 四舍五入，123.4568
        BigDecimal d3 = d1.setScale(4, RoundingMode.DOWN); // 直接截断，123.4567
        System.out.println(d2);
        System.out.println(d3);

        BigDecimal n1 = new BigDecimal("12.345");
        BigDecimal m1 = new BigDecimal("0.12");
        BigDecimal[] dr = n1.divideAndRemainder(m1);
        System.out.println(dr[0]); // 102
        System.out.println(dr[1]); // 0.105
    }
}
